package com.guslegend.Class01_ioc;

import org.springframework.beans.factory.FactoryBean;

/**
 * @author: guslegend
 * @description: FactoryBean实现类
 * @create: 2025-04-27 11:10
 **/
public class HappyFactoryBean implements FactoryBean<HappyPlay> {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    @Override
    public HappyPlay getObject() throws Exception {

        // 方法内部模拟创建、设置一个对象的复杂过程
        HappyPlay happyPlay=new HappyPlay();
        happyPlay.setName(this.name);
        return happyPlay;
    }

    @Override
    public Class<?> getObjectType() {
        // 返回要生产的对象的类型
        return HappyPlay.class;
    }
}
